/*
 * @Author: wurangkun
 * @Date: 2024-07-12 21:53:56
 * @LastEditTime: 2024-07-24 11:30:08
 * @LastEditors: wurangkun
 * @FilePath: \my-app\app\pages\userInfo\profile\index.tsx
 * @Description: 
 */
import Page from '@/components/page'
import { ScreenBar } from '@/components/ScreenBar'
import { to } from '@/hooks/routerHooks'
import { useRoute } from '@react-navigation/native'
import { Stack, Link, router, useFocusEffect, useRootNavigationState } from 'expo-router'
import React, { useEffect, useState } from 'react'
import { View, Text, Button } from 'react-native'
import Animated from 'react-native-reanimated'

export default function Profile() {
  useEffect(() => {
    // 组件已挂载，可以在这里执行需要的操作  
    console.log('组件已挂载');


    // 清理函数（可选）  
    return () => {
      // 组件卸载前执行的清理工作  
      console.log('组件即将卸载');
    };
  }, [])
  //  
  useFocusEffect(
    React.useCallback(() => {
      // 这里会在路由聚焦时运行  
      console.log('路由聚焦了');

      // 清理函数（可选）  
      return () => {
        // 这里会在路由失去焦点时运行  
        console.log('路由失去焦点了');
      };
    }, []) // 依赖项数组  
  );

  const toUerInfo = () => {
    to('/pages/userInfo')
  }

  const toLogin = () => {
    // to('/pages/userInfo')
    to("/pages/login")
  }

  return (
    <Page title='个人列表' animation='fade_from_bottom'>
      <View style={{ flex: 1, backgroundColor: "#fff" }}>
        <View style={{ flex: 1, alignItems: 'center', justifyContent: 'center', backgroundColor: "#fff" }}>
          <Text onPress={toLogin}>toLogin</Text>
          <Text onPress={toUerInfo}>toUerInfo</Text>
        </View>
      </View>
    </Page>
  )
}